import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import clear from 'rollup-plugin-clear';

const jsDir = "src"
const tsPlugins = [
  typescript({
    tsconfig: './tsconfig.json'
  })
]
const baseOutput = {
  dir: "./dist"
}
const config = [
  {
    input: `${jsDir}/background.ts`,
    output: [
      {
        ...baseOutput,
        entryFileNames: `${jsDir}/background.js`,
        format: 'es',
        sourcemap: true,
      }
    ],
    plugins: [
      clear({ targets: ["./dist"]}),
      ...tsPlugins
    ]
  },
]
export default config;